<?php
//include 'checkLogin.php';

@$name = $_REQUEST['name'];
@$price = $_REQUEST['price'];
@$status = $_REQUEST['status'];
@$typeId = $_REQUEST['typeId'];
@$type = $_REQUEST['type'];
@$goods = $_REQUEST['goods'];

include 'db/li.php';


if(!empty($goods)){
	if(empty($name)||empty($price)||empty($status)||empty($typeId)){
		$mes = '都必须填写';
		include 'addGoods.php';
		die;
	}
	
	@$flog = dbInsert('insert into goods(name,price,status,typeId) values(:name,:price,:status,:typeId)',array('name'=>$name,'price'=>$price,'status'=>$status,'typeId'=>$typeId));
	
	if(!$flog){
		$mes = '添加商品失败';
		include 'addGoods.php';
		die;
	}
	$mes = '添加商品成功';
	include 'addGoods.php';
	die;
}

if(!empty($type)){
	
	@$flog = dbInsert('insert into type(name) values(:name)',array('name'=>$name));
	
	if(!$flog){
		$mes = '添加商品类型失败';
		include 'addType.php';
		die;
	}
	$mes = '添加商品类型成功';
	include 'addType.php';
	die;
	
}


